/**
 * kenburnsy - Easy to use JQuery plugin to make slideshows with Ken Burns effect
 * @version v0.0.5
 * @link https://github.com/ZeroOneStudio/kenburnsy
 * @license MIT
 */
!function(t,e,n){function i(e,n){this.el=e,this.$el=t(e),this.settings=t.extend({},r,n),this._defaults=r,this._name=s,this._slides=[],this.currentIndex=0,this.init()}var s="kenburnsy",r={fullscreen:!1,duration:9e3,fadeInDuration:1500,height:null},o={zoomOut:function(e,n){t(e).velocity({rotateZ:"3deg",scale:"1.1"},0).velocity({translateZ:0,rotateZ:"0deg",scale:"1"},n)},zoomIn:function(e,n){t(e).velocity({rotateZ:"0deg",scale:"1"},0).velocity({translateZ:0,rotateZ:"3deg",scale:"1.1"},n)}},a=function(e){var n=function(t){function n(){s(),setTimeout(function(){t.resolve(r)})}function i(){s(),t.rejectWith(r)}function s(){r.onload=null,r.onerror=null,r.onabort=null}var r=new Image;r.onload=n,r.onerror=i,r.onabort=i,r.src=e};return t.Deferred(n).promise()};Object.keys||(Object.keys=function(t){if(t!==Object(t))throw new TypeError("Object.keys called on a non-object");var e,n=[];for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&n.push(e);return n}),t.extend(i.prototype,{init:function(){var e,n=this.settings,i=this;e=this.$el.children().map(function(t,e){return e.src}),this.$el.addClass(function(){var t=[s];return n.fullscreen&&t.push("fullscreen"),t.join(" ")}),t.when.apply(t,t.map(e,a)).done(function(){var t=Array.prototype.slice.call(arguments);i.buildScene(t)})},reveal:function(e){var n=this._slides[e],i=this.$el;t(n).velocity({opacity:0},0,function(){t(this).appendTo(i)}).velocity({opacity:1,translateZ:0},{duration:this.settings.fadeInDuration,queue:!1})},animate:function(t){var e=Object.keys(o),n=o[e[Math.floor(e.length*Math.random())]],i=this.settings.duration,s=this._slides[t];n(s,i)},show:function(t){this.reveal(t),this.animate(t)},next:function(){this.currentIndex=0===this.currentIndex?this._slides.length-1:this.currentIndex-1,this.show(this.currentIndex)},addSlides:function(e){var i=this.el;return t.map(e.reverse(),function(t){var e=n.createElement("div");return e.style.backgroundImage="url("+t.src+")",e.className="slide",i.appendChild(e),e})},buildScene:function(t){var e=this,n=this.settings;this.el.innerHTML="",this._slides=this.addSlides(t),this.currentIndex=t.length-1,n.fullscreen||(this.el.style.height=this.settings.height||t[this.currentIndex].height+"px"),this.animate(this.currentIndex),setInterval(function(){e.next()},n.duration-n.fadeInDuration)}}),t.fn[s]=function(e){return this.each(function(){t.data(this,"plugin_"+s)||t.data(this,"plugin_"+s,new i(this,e))}),this}}(jQuery,window,document);